package com.online.studyonline.exception;


import com.online.studyonline.pojo.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandle {
    @ExceptionHandler(Exception.class)
    public Result handleException(Exception e){
        e.printStackTrace();
//        return Result.error("操作失败");
        return Result.error(e.getMessage().length()<50?"操作失败":e.getMessage());
    }
}
